Skip to content

String.new(capacity: size) - #499

Merged
eregon merged 2 commits into
ruby:masterfrom
andrykonchin:add-specs-for-string-new-capacity-argument
Oct 15, 2017
Merged

eregon merged 2 commits into
ruby:masterfrom
andrykonchin:add-specs-for-string-new-capacity-argument

Conversation

@andrykonchin

Copy link
Copy Markdown
Member

Related issue #473

@andrykonchin

andrykonchin commented Oct 12, 2017 •

Copy link
Copy Markdown
Member Author

@eregon I see a lot of ruby_version_is '...2.3' do and ruby_version_is '2.3' do version guards.
Does it mean these specs don't run for Ruby 2.4? Should these guards be updated?

@eregon

eregon commented Oct 14, 2017

Copy link
Copy Markdown
Member

ruby_version_is '2.3' do means RUBY_VERSION >= 2.3. so they apply on 2.4 and future version too.
ruby_version_is ''...'2.3' means RUBY_VERSION < 2.3. It's a bit confusing and we need better documentation, sorry.

Comment thread core/string/new_spec.rb Outdated

ruby_version_is "2.4" do
it "accepts a capacity argument" do
lambda { String.new("", capacity: 100_000) }.should_not raise_error

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, it's hard to know if this did anything.
should_not raise_error is the least useful matcher, could you replace it with .should == "" and
add an example where the first String argument is not empty?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eregon OK, done

@eregon eregon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@eregon
eregon merged commit 5a0f22a into ruby:master Oct 15, 2017
@andrykonchin
andrykonchin deleted the add-specs-for-string-new-capacity-argument branch April 18, 2018 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants